@friggframework/api-module-pipedrive 0.11.1 → 1.0.1-canary.36.7e495fb.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.
@@ -1,9 +1,11 @@
1
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.jpeg",
7
- "categories": ["Sales"],
8
- "description": "Pipedrive"
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"
9
11
  }
package/definition.js ADDED
@@ -0,0 +1,54 @@
1
+ require('dotenv').config();
2
+ const { Api } = require('./api');
3
+ const { get } = require('@friggframework/core');
4
+ const config = require('./defaultConfig.json');
5
+
6
+ const Definition = {
7
+ API: Api,
8
+ getName: function () {
9
+ return config.name;
10
+ },
11
+ moduleName: config.name,
12
+ modelName: 'Pipedrive',
13
+ requiredAuthMethods: {
14
+ getAuthorizationRequirements: async function (params) {
15
+ return {
16
+ url: await this.api.getAuthUri(),
17
+ type: 'oauth2',
18
+ };
19
+ },
20
+ getToken: async function (api, params) {
21
+ const code = get(params.data, 'code');
22
+ return api.getTokenFromCode(code);
23
+ },
24
+ getEntityDetails: async function (api, callbackParams, tokenResponse, userId) {
25
+ const userDetails = await api.getUser();
26
+ return {
27
+ identifiers: { externalId: userDetails.data.id, user: userId },
28
+ details: { name: userDetails.data.name || userDetails.data.email }
29
+ };
30
+ },
31
+ apiPropertiesToPersist: {
32
+ credential: ['access_token', 'refresh_token', 'companyDomain'],
33
+ entity: []
34
+ },
35
+ getCredentialDetails: async function (api, userId) {
36
+ const userDetails = await api.getUser();
37
+ return {
38
+ identifiers: { externalId: userDetails.data.id, user: userId },
39
+ details: {}
40
+ };
41
+ },
42
+ testAuthRequest: async function (api) {
43
+ return api.getUser();
44
+ }
45
+ },
46
+ env: {
47
+ client_id: process.env.PIPEDRIVE_CLIENT_ID,
48
+ client_secret: process.env.PIPEDRIVE_CLIENT_SECRET,
49
+ scope: process.env.PIPEDRIVE_SCOPE,
50
+ redirect_uri: `${process.env.REDIRECT_URI}/pipedrive`
51
+ }
52
+ };
53
+
54
+ module.exports = { Definition };
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
- const { Api } = require('./api');
2
- const { Credential } = require('./models/credential');
3
- const { Entity } = require('./models/entity');
1
+ const {Api} = require('./api');
2
+ const {Credential} = require('./models/credential');
3
+ const {Entity} = require('./models/entity');
4
4
  const ModuleManager = require('./manager');
5
5
  const Config = require('./defaultConfig');
6
6
 
package/jest-setup.js CHANGED
@@ -1,2 +1,2 @@
1
- const { globalSetup } = require('@friggframework/test-environment');
1
+ const {globalSetup} = require('@friggframework/test');
2
2
  module.exports = globalSetup;
package/jest-teardown.js CHANGED
@@ -1,2 +1,2 @@
1
- const { globalTeardown } = require('@friggframework/test-environment');
1
+ const {globalTeardown} = require('@friggframework/test');
2
2
  module.exports = globalTeardown;
package/manager.js CHANGED
@@ -1,18 +1,20 @@
1
- const _ = require('lodash');
2
- const { Api } = require('./api.js');
3
- const { Entity } = require('./models/entity');
4
- const { Credential } = require('./models/credential');
5
1
  const {
6
2
  ModuleManager,
7
3
  ModuleConstants,
8
- } = require('@friggframework/module-plugin');
9
- const { flushDebugLog, debug } = require('@friggframework/logs');
4
+ flushDebugLog,
5
+ debug
6
+ } = require('@friggframework/core');
7
+ const {Api} = require('./api.js');
8
+ const {Entity} = require('./models/entity');
9
+ const {Credential} = require('./models/credential');
10
10
  const Config = require('./defaultConfig.json');
11
11
 
12
12
  class Manager extends ModuleManager {
13
- static Entity = Entity;
13
+ static
14
+ Entity = Entity;
14
15
 
15
- static Credential = Credential;
16
+ static
17
+ Credential = Credential;
16
18
 
17
19
  constructor(params) {
18
20
  super(params);
@@ -22,10 +24,11 @@ class Manager extends ModuleManager {
22
24
  return Config.name;
23
25
  }
24
26
 
25
- static async getInstance(params) {
27
+ static
28
+ async getInstance(params) {
26
29
  const instance = new this(params);
27
30
 
28
- const apiParams = { delegate: instance };
31
+ const apiParams = {delegate: instance};
29
32
  if (params.entityId) {
30
33
  instance.entity = await instance.entityMO.get(params.entityId);
31
34
  instance.credential = await instance.credentialMO.get(
package/mocks/apiMock.js CHANGED
@@ -1,11 +1,13 @@
1
1
  class MockApi {
2
- constructor() {}
2
+ constructor() {
3
+ }
3
4
 
4
5
  /** * Deals ** */
5
6
 
6
7
  async listDeals() {
7
8
  return require('./deals/listDeals');
8
9
  }
10
+
9
11
  /** * Activities ** */
10
12
 
11
13
  async createActivity() {
@@ -1,5 +1,5 @@
1
+ const {Credential: Parent} = require('@friggframework/core');
1
2
  const mongoose = require('mongoose');
2
- const { Credential: Parent } = require('@friggframework/module-plugin');
3
3
 
4
4
  const schema = new mongoose.Schema({
5
5
  accessToken: {
@@ -12,10 +12,10 @@ const schema = new mongoose.Schema({
12
12
  trim: true,
13
13
  lhEncrypt: true,
14
14
  },
15
- companyDomain: { type: String },
15
+ companyDomain: {type: String},
16
16
  });
17
17
 
18
18
  const name = 'PipedriveCredential';
19
19
  const Credential =
20
20
  Parent.discriminators?.[name] || Parent.discriminator(name, schema);
21
- module.exports = { Credential };
21
+ module.exports = {Credential};
package/models/entity.js CHANGED
@@ -1,9 +1,9 @@
1
+ const {Entity: Parent} = require('@friggframework/core');
1
2
  'use strict';
2
3
  const mongoose = require('mongoose');
3
- const { Entity: Parent } = require('@friggframework/module-plugin');
4
4
 
5
5
  const schema = new mongoose.Schema({});
6
6
  const name = 'PipedriveEntity';
7
7
  const Entity =
8
8
  Parent.discriminators?.[name] || Parent.discriminator(name, schema);
9
- module.exports = { Entity };
9
+ module.exports = {Entity};
package/package.json CHANGED
@@ -1,26 +1,27 @@
1
1
  {
2
- "version": "0.11.1",
3
- "name": "@friggframework/api-module-pipedrive",
4
- "prettier": "@friggframework/prettier-config",
5
- "description": "",
6
- "main": "index.js",
7
- "scripts": {
8
- "lint:fix": "prettier --write --loglevel error . && eslint . --fix",
9
- "test": "jest"
10
- },
11
- "author": "",
12
- "license": "MIT",
13
- "devDependencies": {
14
- "@friggframework/eslint-config": "^1.0.8",
15
- "@friggframework/test-environment": "^1.1.6",
16
- "eslint": "^8.22.0",
17
- "jest": "^28.1.3",
18
- "prettier": "^2.7.1",
19
- "sinon": "^14.0.0"
20
- },
21
- "dependencies": {
22
- "@friggframework/assertions": "^1.0.8",
23
- "@friggframework/module-plugin": "^1.1.3"
24
- },
25
- "gitHead": "a13c56185f26a9b5accc8be1286cd34f0139989f"
2
+ "name": "@friggframework/api-module-pipedrive",
3
+ "version": "1.0.1-canary.36.7e495fb.0",
4
+ "description": "Pipedrive CRM API module for Frigg Framework",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "jest --passWithNoTests"
8
+ },
9
+ "keywords": [
10
+ "frigg",
11
+ "api",
12
+ "pipedrive",
13
+ "crm",
14
+ "sales"
15
+ ],
16
+ "author": "Frigg Framework Team",
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "@friggframework/core": "^2.0.0-next.24",
20
+ "@friggframework/devtools": "^2.0.0-next.24",
21
+ "dotenv": "^16.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "jest": "^29.0.0"
25
+ },
26
+ "gitHead": "7e495fbd0a1c9cd0836b2b0ec174ee36c1f59207"
26
27
  }