@openfn/language-facebook 0.2.3 → 0.3.2

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,17 +1,16 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "properties": {
4
- "accessToken": {
5
- "title": "Access Token",
6
- "type": "string",
7
- "description": "Your Facebook API access token",
8
- "writeOnly": true,
9
- "minLength": 1
10
- }
11
- },
12
- "type": "object",
13
- "additionalProperties": true,
14
- "required": [
15
- "accessToken"
16
- ]
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$comment": "OAuth2",
4
+ "properties": {
5
+ "access_token": {
6
+ "title": "Access Token",
7
+ "type": "string",
8
+ "description": "Your Facebook API access token",
9
+ "writeOnly": true,
10
+ "minLength": 1
11
+ }
12
+ },
13
+ "type": "object",
14
+ "additionalProperties": true,
15
+ "required": ["access_token"]
17
16
  }
package/dist/index.cjs CHANGED
@@ -58,6 +58,7 @@ __export(Adaptor_exports, {
58
58
  sourceValue: () => import_language_common2.sourceValue
59
59
  });
60
60
  var import_language_common = require("@openfn/language-common");
61
+ var import_util = require("@openfn/language-common/util");
61
62
  var import_request = __toESM(require("request"), 1);
62
63
  var import_language_common2 = require("@openfn/language-common");
63
64
  function execute(...operations) {
@@ -68,7 +69,8 @@ function execute(...operations) {
68
69
  return (state) => {
69
70
  return (0, import_language_common.execute)(...operations)({
70
71
  ...initialState,
71
- ...state
72
+ ...state,
73
+ configuration: (0, import_util.normalizeOauthConfig)(state.configuration)
72
74
  });
73
75
  };
74
76
  }
@@ -98,8 +100,8 @@ function postMessage(params) {
98
100
  headers,
99
101
  json: body
100
102
  },
101
- function(error, response, body2) {
102
- error = assembleError({ error, response });
103
+ function(err, response, body2) {
104
+ const error = assembleError({ error: err, response });
103
105
  if (error) {
104
106
  reject(error);
105
107
  console.log(response);
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  expandReferences,
26
26
  composeNextState
27
27
  } from "@openfn/language-common";
28
+ import { normalizeOauthConfig } from "@openfn/language-common/util";
28
29
  import request from "request";
29
30
  import {
30
31
  field,
@@ -46,7 +47,8 @@ function execute(...operations) {
46
47
  return (state) => {
47
48
  return commonExecute(...operations)({
48
49
  ...initialState,
49
- ...state
50
+ ...state,
51
+ configuration: normalizeOauthConfig(state.configuration)
50
52
  });
51
53
  };
52
54
  }
@@ -76,8 +78,8 @@ function postMessage(params) {
76
78
  headers,
77
79
  json: body
78
80
  },
79
- function(error, response, body2) {
80
- error = assembleError({ error, response });
81
+ function(err, response, body2) {
82
+ const error = assembleError({ error: err, response });
81
83
  if (error) {
82
84
  reject(error);
83
85
  console.log(response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-facebook",
3
- "version": "0.2.3",
3
+ "version": "0.3.2",
4
4
  "description": "An Language Package for Facebook Messenger API",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -12,7 +12,7 @@
12
12
  "configuration-schema.json"
13
13
  ],
14
14
  "dependencies": {
15
- "@openfn/language-common": "^1.7.6",
15
+ "@openfn/language-common": "^1.10.0",
16
16
  "request": "^2.88.2"
17
17
  },
18
18
  "devDependencies": {
@@ -45,6 +45,7 @@
45
45
  "test": "mocha --experimental-specifier-resolution=node --no-warnings",
46
46
  "test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
47
47
  "clean": "rimraf dist types docs",
48
- "pack": "pnpm pack --pack-destination ../../dist"
48
+ "pack": "pnpm pack --pack-destination ../../dist",
49
+ "lint": "eslint src"
49
50
  }
50
51
  }