@vouchfor/sdk 1.1.39 → 1.1.40

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.
@@ -80,6 +80,10 @@ class TaskBroker {
80
80
  }
81
81
 
82
82
  fail(id, value) {
83
+ this.history.set(id, {
84
+ ts: Date.now(),
85
+ value
86
+ });
83
87
  const entry = this.pending.get(id);
84
88
  if (!entry) return false;
85
89
  entry.reject(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/sdk",
3
- "version": "1.1.39",
3
+ "version": "1.1.40",
4
4
  "description": "Vouch API SDK",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep -l \"Router\\\\\\(\\\\\\)\" /home/david/dev/vouch-new/amplify/backend/function/restapi/lib/controllers/*.ts | xargs grep -L \"@openapi\")",
5
- "Bash(for f:*)",
6
- "Bash(cd /home/david/dev/vouch-new/amplify/backend/function/restapi/openapi && node -e \"const s = require\\('./components/schemas'\\); console.log\\(Object.keys\\(s\\).join\\(', '\\)\\)\" 2>&1)",
7
- "Bash(cd /home/david/dev/vouch-new/amplify/backend/function/restapi/openapi && node -e \"const r = require\\('./components/responses'\\); console.log\\(Object.keys\\(r\\).join\\(', '\\)\\)\" 2>&1)"
8
- ]
9
- }
10
- }
package/test-accounts.js DELETED
@@ -1,16 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
- const id = 'WncEfS4KgY';
10
-
11
- (async () => {
12
- const accounts = await vouchClient.accounts.list(apiKey).catch(() => undefined);
13
- console.log(accounts);
14
- const account = await vouchClient.accounts.get(id, apiKey).catch(() => undefined);
15
- console.log(account);
16
- })();
package/test-answers.js DELETED
@@ -1,17 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
-
10
- (async () => {
11
- const params = {
12
- //query: 'clients',
13
- limit: 5
14
- };
15
- const data = await vouchClient.answers.search(params, apiKey).catch(() => undefined);
16
- console.log(data);
17
- })();
package/test-assets.js DELETED
@@ -1,17 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
-
10
- (async () => {
11
- const params = {
12
- //query: 'clients',
13
- limit: 5
14
- };
15
- const data = await vouchClient.assets.search(params, apiKey).catch(() => undefined);
16
- console.log(data);
17
- })();
package/test-callback.js DELETED
@@ -1,21 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- callbackUrl: 'https://extrajudicial-melanie-unadministratively.ngrok-free.dev/callback'
7
- }, console);
8
-
9
- console.log(vouchClient);
10
-
11
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
12
-
13
- (async () => {
14
- const params = {
15
- query: 'why',
16
- limit: 2
17
- };
18
- const data = await vouchClient.campaigns.search(params, apiKey).catch(() => undefined);
19
- console.log(data);
20
- })();
21
-
package/test-campaigns.js DELETED
@@ -1,20 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- console.log(vouchClient);
9
-
10
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
11
-
12
- (async () => {
13
- const params = {
14
- query: 'why',
15
- limit: 2
16
- };
17
- const data = await vouchClient.campaigns.search(params, apiKey).catch(() => undefined);
18
- console.log(data);
19
- })();
20
-
package/test-canva.js DELETED
@@ -1,53 +0,0 @@
1
- const axios = require('axios');
2
- const Vouch = require("./lib/vouch");
3
-
4
- const vouchClient = new Vouch({
5
- env: 'dev',
6
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
7
- }, console);
8
-
9
- const VOUCH_APPLICATION_API_KEY = vouchClient.integrationKey;
10
-
11
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
12
-
13
- const answerBaseUrl = vouchClient.vouches._baseUrl.replace('/vouches', '/answers');
14
- const listAnswersUrl = answerBaseUrl;
15
- const trackAnswerUrl = answerBaseUrl + '/track';
16
-
17
- const listAssetsUrl = vouchClient.vouches._baseUrl.replace('/vouches', '/assets');
18
-
19
- const listAnswers = (key, params) => {
20
- return axios({
21
- method: 'GET',
22
- params,
23
- url: listAnswersUrl,
24
- headers: {
25
- accept: 'application/json',
26
- 'content-type': 'application/json',
27
- 'x-integration-key': VOUCH_APPLICATION_API_KEY,
28
- 'x-api-key': key
29
- }
30
- });
31
- };
32
-
33
- const listAssets = (key, params) => {
34
- return axios({
35
- method: 'GET',
36
- params,
37
- url: listAssetsUrl,
38
- headers: {
39
- accept: 'application/json',
40
- 'content-type': 'application/json',
41
- 'x-integration-key': VOUCH_APPLICATION_API_KEY,
42
- 'x-api-key': key
43
- }
44
- });
45
- };
46
-
47
- (async () => {
48
- const params = {
49
- query: 'clients'
50
- };
51
- const data = await listAnswers(apiKey, params).catch(() => undefined);
52
- console.log(data.data);
53
- })();
package/test-commit.js DELETED
@@ -1,11 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- (async () => {
9
- vouchClient.utilities.commit().catch(() => undefined);
10
- vouchClient.integrations.commit().catch(() => undefined);
11
- })();
@@ -1,15 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
-
10
- (async () => {
11
- const data = await vouchClient.compositions.get('fMMsKxK9Ic', apiKey)
12
- .then((data) => console.log('data', data))
13
- .catch((err) => console.log('error', err));
14
- })();
15
-
package/test-images.js DELETED
@@ -1,41 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
-
10
- (async () => {
11
- {
12
- const params = {
13
- query: 'why',
14
- limit: 2
15
- };
16
- const data = await vouchClient.images.search(params, apiKey).catch(() => undefined);
17
- console.log(data);
18
- }
19
- {
20
- const params = {
21
- account: {
22
- email: 'david@vouchfor.com'
23
- },
24
- image: {
25
- name: 'Image from Url',
26
- externalid: '777888999000',
27
- url: 'https://googlechrome.github.io/samples/picture-element/images/butterfly.webp',
28
- sourceUrl: 'https://googlechrome.github.io/samples/picture-element/images/butterfly.webp',
29
- source: 'TEST'
30
- }
31
- };
32
- const data = await vouchClient.images.upload(params, apiKey).catch(() => undefined);
33
- console.log(data);
34
- }
35
- {
36
- const id = '777888999000';
37
- const data = await vouchClient.images.get(id, apiKey).catch(() => undefined);
38
- console.log(data);
39
- }
40
- })();
41
-
package/test-poll.js DELETED
@@ -1,10 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- (async () => {
9
- vouchClient.poll();
10
- })();
package/test-search.js DELETED
@@ -1,18 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
-
10
- (async () => {
11
- const params = {
12
- query: 'clients',
13
- limit: 2
14
- };
15
- const data = await vouchClient.vouches.search(params, apiKey).catch(() => undefined);
16
- console.log(data);
17
- })();
18
-
package/test-upload.js DELETED
@@ -1,17 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M',
6
- }, console);
7
-
8
- const apiKey = 'kTYGShoaeg-QvraTZk9LmHNsxP4dWcye82uJB6Rf0XtIsgq7UaEcYpVhMDl3z';
9
- const url = 'https://examplefiles.org/files/video/mp4-example-video-download-640x480.mp4'
10
- const key1 = 'delete/file_example_MP4_480_1_5MG.mp4';
11
- const key2 = 'delete/file_example_MP4_480_1_EXT';
12
-
13
- (async () => {
14
- const result = await vouchClient.files.proxy(url, key1, apiKey, { extract: true, extname: true }).catch(() => undefined);
15
- console.log(result);
16
- })();
17
-
package/test.js DELETED
@@ -1,23 +0,0 @@
1
- const Vouch = require("./lib/vouch");
2
-
3
- const vouchClient = new Vouch({
4
- env: 'dev',
5
- integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M'
6
- });
7
-
8
- (async () => {
9
- const response = await vouchClient.integrations.applications.list();
10
- console.log(typeof response);
11
- const items = await response.applications.reduce(async (ac, application) => {
12
- const arr = await ac;
13
- console.log(`id => ${application.id}`);
14
- try {
15
- const credentials = await vouchClient.integrations.authenticate({ entityId: application.entity.id });
16
- arr.push(credentials);
17
- } catch (err) {
18
- console.error(`failed to get credentials ${err} - ${application.id}`);
19
- }
20
-
21
- return arr;
22
- }, Promise.resolve([]));
23
- })();