@friggframework/api-module-pipedrive 2.1.0-canary.56.2dc58f9.0 → 2.1.0-next.0
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 +2 -2
- package/dist/api.js +16 -18
- package/dist/defaultConfig.json +11 -0
- package/dist/definition.d.ts +2 -2
- package/dist/definition.js +11 -14
- package/package.json +4 -3
- package/defaultConfig.json +0 -11
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OAuth2Requester } from
|
|
2
|
-
import { OAuth2RequesterOptions, ActivityParams, ListActivitiesParams, ListDealsParams, ListPersonsParams, GetPersonParams, PipedriveResponse, PipedriveUser, PipedriveTokenResponse } from
|
|
1
|
+
import { OAuth2Requester } from "@friggframework/core";
|
|
2
|
+
import { OAuth2RequesterOptions, ActivityParams, ListActivitiesParams, ListDealsParams, ListPersonsParams, GetPersonParams, PipedriveResponse, PipedriveUser, PipedriveTokenResponse } from "./types";
|
|
3
3
|
export declare class Api extends OAuth2Requester {
|
|
4
4
|
companyDomain: string | null;
|
|
5
5
|
URLs: {
|
package/dist/api.js
CHANGED
|
@@ -5,22 +5,20 @@ const core_1 = require("@friggframework/core");
|
|
|
5
5
|
class Api extends core_1.OAuth2Requester {
|
|
6
6
|
constructor(params) {
|
|
7
7
|
super(params);
|
|
8
|
-
this.companyDomain = (0, core_1.get)(params,
|
|
9
|
-
|
|
10
|
-
this.baseUrl = `${this.companyDomain}/api`;
|
|
11
|
-
}
|
|
8
|
+
this.companyDomain = (0, core_1.get)(params, "companyDomain", null);
|
|
9
|
+
this.baseUrl = `${this.companyDomain}/api`;
|
|
12
10
|
this.URLs = {
|
|
13
|
-
activities:
|
|
14
|
-
activityFields:
|
|
11
|
+
activities: "/v2/activities",
|
|
12
|
+
activityFields: "/v1/activityFields",
|
|
15
13
|
activityById: (activityId) => `/v2/activities/${activityId}`,
|
|
16
|
-
getUser:
|
|
17
|
-
users:
|
|
18
|
-
deals:
|
|
19
|
-
persons:
|
|
14
|
+
getUser: "/v1/users/me",
|
|
15
|
+
users: "/v1/users",
|
|
16
|
+
deals: "/v2/deals",
|
|
17
|
+
persons: "/v2/persons",
|
|
20
18
|
personById: (personId) => `/v2/persons/${personId}`,
|
|
21
19
|
};
|
|
22
20
|
this.authorizationUri = encodeURI(`https://oauth.pipedrive.com/oauth/authorize?client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&response_type=code&scope=${this.scope}`);
|
|
23
|
-
this.tokenUri =
|
|
21
|
+
this.tokenUri = "https://oauth.pipedrive.com/oauth/token";
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
26
24
|
* Sets OAuth tokens and captures the Pipedrive company domain
|
|
@@ -33,7 +31,7 @@ class Api extends core_1.OAuth2Requester {
|
|
|
33
31
|
await this.setCompanyDomain(params.api_domain);
|
|
34
32
|
}
|
|
35
33
|
else if (!this.companyDomain) {
|
|
36
|
-
throw new Error(
|
|
34
|
+
throw new Error("Pipedrive api_domain not provided in token response");
|
|
37
35
|
}
|
|
38
36
|
return super.setTokens(params);
|
|
39
37
|
}
|
|
@@ -43,9 +41,9 @@ class Api extends core_1.OAuth2Requester {
|
|
|
43
41
|
*/
|
|
44
42
|
async setCompanyDomain(companyDomain) {
|
|
45
43
|
if (!companyDomain) {
|
|
46
|
-
throw new Error(
|
|
44
|
+
throw new Error("Company domain is required for Pipedrive API");
|
|
47
45
|
}
|
|
48
|
-
const formattedDomain = companyDomain.startsWith(
|
|
46
|
+
const formattedDomain = companyDomain.startsWith("http")
|
|
49
47
|
? companyDomain
|
|
50
48
|
: `https://${companyDomain}`;
|
|
51
49
|
this.companyDomain = formattedDomain;
|
|
@@ -101,14 +99,14 @@ class Api extends core_1.OAuth2Requester {
|
|
|
101
99
|
return this._patch(options);
|
|
102
100
|
}
|
|
103
101
|
async createActivity(params) {
|
|
104
|
-
const dealId = (0, core_1.get)(params,
|
|
105
|
-
const subject = (0, core_1.get)(params,
|
|
106
|
-
const type = (0, core_1.get)(params,
|
|
102
|
+
const dealId = (0, core_1.get)(params, "dealId", null);
|
|
103
|
+
const subject = (0, core_1.get)(params, "subject");
|
|
104
|
+
const type = (0, core_1.get)(params, "type");
|
|
107
105
|
const options = {
|
|
108
106
|
url: this.baseUrl + this.URLs.activities,
|
|
109
107
|
body: { ...params },
|
|
110
108
|
headers: {
|
|
111
|
-
|
|
109
|
+
"Content-Type": "application/json",
|
|
112
110
|
},
|
|
113
111
|
};
|
|
114
112
|
return this._post(options);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pipedrive",
|
|
3
|
+
"label": "PipeDrive CRM",
|
|
4
|
+
"productUrl": "https://pipedrive.com",
|
|
5
|
+
"apiDocs": "https://developer.pipedrive.com",
|
|
6
|
+
"logoUrl": "https://friggframework.org/assets/img/pipedrive-icon.png",
|
|
7
|
+
"categories": [
|
|
8
|
+
"Sales"
|
|
9
|
+
],
|
|
10
|
+
"description": "Pipedrive"
|
|
11
|
+
}
|
package/dist/definition.d.ts
CHANGED
package/dist/definition.js
CHANGED
|
@@ -7,17 +7,17 @@ exports.Definition = void 0;
|
|
|
7
7
|
require("dotenv/config");
|
|
8
8
|
const api_1 = require("./api");
|
|
9
9
|
const core_1 = require("@friggframework/core");
|
|
10
|
-
const defaultConfig_json_1 = __importDefault(require("
|
|
10
|
+
const defaultConfig_json_1 = __importDefault(require("./defaultConfig.json"));
|
|
11
11
|
const Definition = {
|
|
12
12
|
API: api_1.Api,
|
|
13
13
|
getName: () => defaultConfig_json_1.default.name,
|
|
14
14
|
moduleName: defaultConfig_json_1.default.name,
|
|
15
|
-
modelName:
|
|
15
|
+
modelName: "Pipedrive",
|
|
16
16
|
requiredAuthMethods: {
|
|
17
17
|
getToken: async (api, params) => {
|
|
18
|
-
const code = (0, core_1.get)(params
|
|
18
|
+
const code = (0, core_1.get)(params, "code");
|
|
19
19
|
if (!code) {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error("Authorization code is required");
|
|
21
21
|
}
|
|
22
22
|
return api.getTokenFromCode(code);
|
|
23
23
|
},
|
|
@@ -30,10 +30,11 @@ const Definition = {
|
|
|
30
30
|
return {
|
|
31
31
|
identifiers: {
|
|
32
32
|
externalId: String(userProfile.data.company_id),
|
|
33
|
-
user: userId
|
|
33
|
+
user: userId,
|
|
34
34
|
},
|
|
35
35
|
details: {
|
|
36
|
-
name: userProfile.data.company_name ||
|
|
36
|
+
name: userProfile.data.company_name || "Unknown Company",
|
|
37
|
+
companyDomain: userProfile.data.company_domain,
|
|
37
38
|
},
|
|
38
39
|
};
|
|
39
40
|
}
|
|
@@ -42,11 +43,7 @@ const Definition = {
|
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
apiPropertiesToPersist: {
|
|
45
|
-
credential: [
|
|
46
|
-
'access_token',
|
|
47
|
-
'refresh_token',
|
|
48
|
-
'companyDomain'
|
|
49
|
-
],
|
|
46
|
+
credential: ["access_token", "refresh_token", "companyDomain"],
|
|
50
47
|
entity: [],
|
|
51
48
|
},
|
|
52
49
|
getCredentialDetails: async (api, userId) => {
|
|
@@ -58,9 +55,9 @@ const Definition = {
|
|
|
58
55
|
return {
|
|
59
56
|
identifiers: {
|
|
60
57
|
externalId: String(userProfile.data.id),
|
|
61
|
-
user: userId
|
|
58
|
+
user: userId,
|
|
62
59
|
},
|
|
63
|
-
details: {}
|
|
60
|
+
details: {},
|
|
64
61
|
};
|
|
65
62
|
}
|
|
66
63
|
catch (error) {
|
|
@@ -74,6 +71,6 @@ const Definition = {
|
|
|
74
71
|
client_secret: process.env.PIPEDRIVE_CLIENT_SECRET,
|
|
75
72
|
scope: process.env.PIPEDRIVE_SCOPE,
|
|
76
73
|
redirect_uri: `${process.env.REDIRECT_URI}/pipedrive`,
|
|
77
|
-
}
|
|
74
|
+
},
|
|
78
75
|
};
|
|
79
76
|
exports.Definition = Definition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/api-module-pipedrive",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
"LICENSE.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@friggframework/core": "^2.0.0",
|
|
21
|
+
"@friggframework/core": "^2.0.0-next.16",
|
|
22
22
|
"dotenv": "^16.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@friggframework/test": "^1.1.2",
|
|
25
26
|
"@types/node": "^20.8.0",
|
|
26
27
|
"typescript": "^5.4.0",
|
|
27
28
|
"vitest": "^1.0.0"
|
|
@@ -29,5 +30,5 @@
|
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "6b9c14cf15aeea687f20104edf08ac39d89b9f88"
|
|
33
34
|
}
|
package/defaultConfig.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pipedrive",
|
|
3
|
-
"label": "PipeDrive CRM",
|
|
4
|
-
"productUrl": "https://pipedrive.com",
|
|
5
|
-
"apiDocs": "https://developer.pipedrive.com",
|
|
6
|
-
"logoUrl": "https://friggframework.org/assets/img/pipedrive-icon.png",
|
|
7
|
-
"categories": [
|
|
8
|
-
"Sales"
|
|
9
|
-
],
|
|
10
|
-
"description": "Pipedrive"
|
|
11
|
-
}
|