@orchesty/connector-wflow 1.0.5 → 2.0.1

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +102 -0
  3. package/package.json +7 -3
  4. package/src/Batch/WflowSubscribeWebhookBatch.ts +2 -0
  5. package/src/Batch/WflowUnsubscribeWebhookBatch.ts +3 -1
  6. package/src/Batch/__tests__/Data/WflowSubscribeWebhookBatch/input.json +2 -1
  7. package/src/Batch/__tests__/Data/WflowSubscribeWebhookBatch/output.json +3 -2
  8. package/src/Batch/__tests__/Data/WflowUnsubscribeWebhookBatch/input.json +3 -2
  9. package/src/Batch/__tests__/Data/WflowUnsubscribeWebhookBatch/output.json +3 -2
  10. package/src/Connector/__tests__/Data/WflowGetDocumentConnector/input.json +8 -7
  11. package/src/Connector/__tests__/Data/WflowGetDocumentConnector/output.json +431 -430
  12. package/src/Connector/__tests__/Data/WflowGetDocumentMainFileConnector/input.json +2 -1
  13. package/src/Connector/__tests__/Data/WflowGetDocumentMainFileConnector/output.json +2 -1
  14. package/src/Connector/__tests__/Data/WflowGetDocumentTypesConnector/input.json +3 -3
  15. package/src/Connector/__tests__/Data/WflowGetDocumentTypesConnector/output.json +2 -1
  16. package/src/Connector/__tests__/Data/WflowGetOrganizationsConnector/input.json +5 -4
  17. package/src/Connector/__tests__/Data/WflowGetOrganizationsConnector/output.json +2 -1
  18. package/src/Connector/__tests__/Data/WflowPatchAccountingRulesConnector/batch-input.json +2 -1
  19. package/src/Connector/__tests__/Data/WflowPatchAccountingRulesConnector/batch-output.json +2 -1
  20. package/src/Connector/__tests__/Data/WflowPatchAccountingRulesConnector/input.json +2 -1
  21. package/src/Connector/__tests__/Data/WflowPatchAccountingRulesConnector/output.json +2 -1
  22. package/src/Connector/__tests__/Data/WflowPatchChartOfAccountsConnector/batch-input.json +2 -1
  23. package/src/Connector/__tests__/Data/WflowPatchChartOfAccountsConnector/batch-output.json +2 -1
  24. package/src/Connector/__tests__/Data/WflowPatchChartOfAccountsConnector/input.json +2 -1
  25. package/src/Connector/__tests__/Data/WflowPatchChartOfAccountsConnector/output.json +2 -1
  26. package/src/Connector/__tests__/Data/WflowPatchContractsConnector/batch-input.json +2 -1
  27. package/src/Connector/__tests__/Data/WflowPatchContractsConnector/batch-output.json +2 -1
  28. package/src/Connector/__tests__/Data/WflowPatchContractsConnector/input.json +2 -1
  29. package/src/Connector/__tests__/Data/WflowPatchContractsConnector/output.json +2 -1
  30. package/src/Connector/__tests__/Data/WflowPatchCostCentersConnector/batch-input.json +2 -1
  31. package/src/Connector/__tests__/Data/WflowPatchCostCentersConnector/batch-output.json +2 -1
  32. package/src/Connector/__tests__/Data/WflowPatchCostCentersConnector/input.json +2 -1
  33. package/src/Connector/__tests__/Data/WflowPatchCostCentersConnector/output.json +2 -1
  34. package/src/Connector/__tests__/Data/WflowPatchSeriesConnector/batch-input.json +2 -1
  35. package/src/Connector/__tests__/Data/WflowPatchSeriesConnector/batch-output.json +2 -1
  36. package/src/Connector/__tests__/Data/WflowPatchSeriesConnector/input.json +2 -1
  37. package/src/Connector/__tests__/Data/WflowPatchSeriesConnector/output.json +2 -1
  38. package/src/Connector/__tests__/Data/WflowPatchVatControlStatementLinesConnector/batch-input.json +2 -1
  39. package/src/Connector/__tests__/Data/WflowPatchVatControlStatementLinesConnector/batch-output.json +2 -1
  40. package/src/Connector/__tests__/Data/WflowPatchVatControlStatementLinesConnector/input.json +2 -1
  41. package/src/Connector/__tests__/Data/WflowPatchVatControlStatementLinesConnector/output.json +2 -1
  42. package/src/Connector/__tests__/Data/WflowPatchVatReturnLinesConnector/batch-input.json +2 -1
  43. package/src/Connector/__tests__/Data/WflowPatchVatReturnLinesConnector/batch-output.json +2 -1
  44. package/src/Connector/__tests__/Data/WflowPatchVatReturnLinesConnector/input.json +2 -1
  45. package/src/Connector/__tests__/Data/WflowPatchVatReturnLinesConnector/output.json +2 -1
  46. package/src/Connector/__tests__/Data/WflowPutDocumentConnector/input.json +3 -2
  47. package/src/Connector/__tests__/Data/WflowPutDocumentConnector/output.json +3 -2
  48. package/src/Connector/__tests__/Data/WflowUpdateDocumentState/input.json +3 -2
  49. package/src/Connector/__tests__/Data/WflowUpdateDocumentState/output.json +3 -2
  50. package/src/WflowApplication.ts +1 -0
  51. package/coverage/clover.xml +0 -381
  52. package/coverage/coverage-final.json +0 -18
  53. package/coverage/lcov-report/base.css +0 -224
  54. package/coverage/lcov-report/block-navigation.js +0 -87
  55. package/coverage/lcov-report/favicon.png +0 -0
  56. package/coverage/lcov-report/index.html +0 -161
  57. package/coverage/lcov-report/prettify.css +0 -1
  58. package/coverage/lcov-report/prettify.js +0 -2
  59. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  60. package/coverage/lcov-report/sorter.js +0 -210
  61. package/coverage/lcov-report/src/Batch/WflowSubscribeWebhookBatch.ts.html +0 -328
  62. package/coverage/lcov-report/src/Batch/WflowUnsubscribeWebhookBatch.ts.html +0 -253
  63. package/coverage/lcov-report/src/Batch/index.html +0 -131
  64. package/coverage/lcov-report/src/Connector/WflowGetDocumentConnector.ts.html +0 -1105
  65. package/coverage/lcov-report/src/Connector/WflowGetDocumentMainFileConnector.ts.html +0 -205
  66. package/coverage/lcov-report/src/Connector/WflowGetDocumentTypesConnector.ts.html +0 -292
  67. package/coverage/lcov-report/src/Connector/WflowGetOrganizationsConnector.ts.html +0 -205
  68. package/coverage/lcov-report/src/Connector/WflowPatchAccountingRulesConnector.ts.html +0 -244
  69. package/coverage/lcov-report/src/Connector/WflowPatchChartOfAccountsConnector.ts.html +0 -211
  70. package/coverage/lcov-report/src/Connector/WflowPatchContractsConnector.ts.html +0 -211
  71. package/coverage/lcov-report/src/Connector/WflowPatchCostCentersConnector.ts.html +0 -211
  72. package/coverage/lcov-report/src/Connector/WflowPatchSeriesConnector.ts.html +0 -268
  73. package/coverage/lcov-report/src/Connector/WflowPatchVatControlStatementLinesConnector.ts.html +0 -211
  74. package/coverage/lcov-report/src/Connector/WflowPatchVatReturnLinesConnector.ts.html +0 -214
  75. package/coverage/lcov-report/src/Connector/WflowPutDocumentConnector.ts.html +0 -532
  76. package/coverage/lcov-report/src/Connector/WflowUpdateDocumentStateConnector.ts.html +0 -193
  77. package/coverage/lcov-report/src/Connector/index.html +0 -296
  78. package/coverage/lcov-report/src/WflowApplication.ts.html +0 -535
  79. package/coverage/lcov-report/src/index.html +0 -116
  80. package/coverage/lcov-report/test/dataProvider.ts.html +0 -307
  81. package/coverage/lcov-report/test/index.html +0 -116
  82. package/coverage/lcov.info +0 -613
  83. package/dist/Batch/WflowSubscribeWebhookBatch.d.ts +0 -7
  84. package/dist/Batch/WflowSubscribeWebhookBatch.js +0 -55
  85. package/dist/Batch/WflowUnsubscribeWebhookBatch.d.ts +0 -7
  86. package/dist/Batch/WflowUnsubscribeWebhookBatch.js +0 -45
  87. package/dist/Connector/WflowGetDocumentConnector.d.ts +0 -310
  88. package/dist/Connector/WflowGetDocumentConnector.js +0 -24
  89. package/dist/Connector/WflowGetDocumentMainFileConnector.d.ts +0 -13
  90. package/dist/Connector/WflowGetDocumentMainFileConnector.js +0 -25
  91. package/dist/Connector/WflowGetDocumentTypesConnector.d.ts +0 -36
  92. package/dist/Connector/WflowGetDocumentTypesConnector.js +0 -28
  93. package/dist/Connector/WflowGetOrganizationsConnector.d.ts +0 -15
  94. package/dist/Connector/WflowGetOrganizationsConnector.js +0 -27
  95. package/dist/Connector/WflowPatchAccountingRulesConnector.d.ts +0 -17
  96. package/dist/Connector/WflowPatchAccountingRulesConnector.js +0 -24
  97. package/dist/Connector/WflowPatchChartOfAccountsConnector.d.ts +0 -15
  98. package/dist/Connector/WflowPatchChartOfAccountsConnector.js +0 -24
  99. package/dist/Connector/WflowPatchContractsConnector.d.ts +0 -15
  100. package/dist/Connector/WflowPatchContractsConnector.js +0 -24
  101. package/dist/Connector/WflowPatchCostCentersConnector.d.ts +0 -15
  102. package/dist/Connector/WflowPatchCostCentersConnector.js +0 -24
  103. package/dist/Connector/WflowPatchSeriesConnector.d.ts +0 -19
  104. package/dist/Connector/WflowPatchSeriesConnector.js +0 -24
  105. package/dist/Connector/WflowPatchVatControlStatementLinesConnector.d.ts +0 -15
  106. package/dist/Connector/WflowPatchVatControlStatementLinesConnector.js +0 -24
  107. package/dist/Connector/WflowPatchVatReturnLinesConnector.d.ts +0 -16
  108. package/dist/Connector/WflowPatchVatReturnLinesConnector.js +0 -24
  109. package/dist/Connector/WflowPutDocumentConnector.d.ts +0 -117
  110. package/dist/Connector/WflowPutDocumentConnector.js +0 -31
  111. package/dist/Connector/WflowUpdateDocumentStateConnector.d.ts +0 -11
  112. package/dist/Connector/WflowUpdateDocumentStateConnector.js +0 -24
  113. package/dist/WflowApplication.d.ts +0 -41
  114. package/dist/WflowApplication.js +0 -133
  115. package/dist/package.json +0 -22
  116. package/tsconfig.prod.tsbuildinfo +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @orchesty/connector-wflow
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated release
8
+
9
+ ## 2.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - Use @orchesty/nodejs-sdk ^5.0
14
+
3
15
  ## 1.0.5
4
16
 
5
17
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Wflow Connector
2
+
3
+ [![npm](https://img.shields.io/npm/v/@orchesty/connector-wflow?color=15ba68)](https://www.npmjs.com/package/@orchesty/connector-wflow)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-15ba68)](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE)
5
+
6
+ An [Orchesty](https://orchesty.io) connector for wflow, a digital accounting platform that automates document processing, extraction, and approval workflows.
7
+
8
+ ## Application Type
9
+
10
+ **OAuth 2.0**
11
+
12
+ This connector uses the wflow OAuth 2.0 authorization flow via `https://account.wflow.com/connect/authorize`. After authorization, the selected organization is stored in a separate settings form that is populated dynamically.
13
+
14
+ > **Note:** `WflowApplication` requires `OAuth2Provider` and `WflowGetOrganizationsConnector` in its constructor.
15
+
16
+ | Field | Description |
17
+ |---|---|
18
+ | `client_id` | Your wflow app Client ID |
19
+ | `client_secret` | Your wflow app Client Secret |
20
+ | `organization` | Selected wflow organization ID (populated after authorization) |
21
+
22
+ ## Components
23
+
24
+ | Class | Type | Description |
25
+ |---|---|---|
26
+ | `WflowGetDocumentConnector` | Connector | Retrieves a document by ID via `GET /{org}/documents/{documentId}` |
27
+ | `WflowGetDocumentMainFileConnector` | Connector | Downloads the main file of a document as base64 via `GET /{org}/documents/{documentId}/files/main/download` |
28
+ | `WflowGetDocumentTypesConnector` | Connector | Lists available document types via `GET /{org}/documents/types` |
29
+ | `WflowGetOrganizationsConnector` | Connector | Lists accessible organizations via `GET /user/myorganizations` |
30
+ | `WflowPatchAccountingRulesConnector` | Connector | Updates accounting rules register entries via `PATCH /{org}/registers/accountingrules` |
31
+ | `WflowPatchChartOfAccountsConnector` | Connector | Updates chart of accounts register entries via `PATCH /{org}/registers/chartofaccounts` |
32
+ | `WflowPatchContractsConnector` | Connector | Updates contracts register entries via `PATCH /{org}/registers/contracts` |
33
+ | `WflowPatchCostCentersConnector` | Connector | Updates cost centers register entries via `PATCH /{org}/registers/costcenters` |
34
+ | `WflowPatchSeriesConnector` | Connector | Updates series register entries via `PATCH /{org}/registers/series` |
35
+ | `WflowPatchVatControlStatementLinesConnector` | Connector | Updates VAT control statement lines via `PATCH /{org}/registers/vatcontrolstatementlines` |
36
+ | `WflowPatchVatReturnLinesConnector` | Connector | Updates VAT return lines via `PATCH /{org}/registers/vatreturnlines` |
37
+ | `WflowPutDocumentConnector` | Connector | Creates or replaces a document via `PUT /{org}/documents` |
38
+ | `WflowUpdateDocumentStateConnector` | Connector | Marks a document export task as processed via `PUT /{org}/documents/{documentId}/task/Export/processed` |
39
+ | `WflowSubscribeWebhookBatch` | Batch | Registers webhook subscriptions via `PUT /{org}/webhookregistrations` |
40
+ | `WflowUnsubscribeWebhookBatch` | Batch | Removes registered webhook subscriptions via `DELETE /{org}/webhookregistrations/{webhookId}` |
41
+
42
+ ## Setup
43
+
44
+ ### Credentials
45
+
46
+ 1. Contact [wflow](https://www.wflow.com/) to obtain API client credentials for your organization.
47
+ 2. In Orchesty, open the wflow application settings, enter the **Client ID** and **Client Secret**, and complete the OAuth authorization flow.
48
+ 3. After authorization, select your **organization** from the dropdown (populated automatically from your wflow account).
49
+
50
+ ### API Documentation
51
+
52
+ wflow API: [https://www.wflow.com/](https://www.wflow.com/)
53
+
54
+ ## Installation & Usage
55
+
56
+ Install the package:
57
+
58
+ ```bash
59
+ npm install @orchesty/connector-wflow @orchesty/nodejs-sdk
60
+ # or
61
+ pnpm add @orchesty/connector-wflow @orchesty/nodejs-sdk
62
+ ```
63
+
64
+ Register the application and nodes in your Orchesty DI container:
65
+
66
+ ```typescript
67
+ import { container } from '@orchesty/nodejs-sdk';
68
+ import { OAuth2Provider } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Provider/OAuth2/OAuth2Provider';
69
+ import WflowApplication from '@orchesty/connector-wflow/dist/WflowApplication';
70
+ import WflowGetOrganizationsConnector from '@orchesty/connector-wflow/dist/Connector/WflowGetOrganizationsConnector';
71
+ import WflowGetDocumentConnector from '@orchesty/connector-wflow/dist/Connector/WflowGetDocumentConnector';
72
+ import WflowPutDocumentConnector from '@orchesty/connector-wflow/dist/Connector/WflowPutDocumentConnector';
73
+ import WflowUpdateDocumentStateConnector from '@orchesty/connector-wflow/dist/Connector/WflowUpdateDocumentStateConnector';
74
+ import WflowSubscribeWebhookBatch from '@orchesty/connector-wflow/dist/Batch/WflowSubscribeWebhookBatch';
75
+ import WflowUnsubscribeWebhookBatch from '@orchesty/connector-wflow/dist/Batch/WflowUnsubscribeWebhookBatch';
76
+
77
+ const getOrgsConnector = new WflowGetOrganizationsConnector();
78
+ const app = new WflowApplication(container.get(OAuth2Provider), getOrgsConnector);
79
+ container.setApplication(app);
80
+ container.setNode(getOrgsConnector, app);
81
+ container.setNode(new WflowGetDocumentConnector(), app);
82
+ container.setNode(new WflowPutDocumentConnector(), app);
83
+ container.setNode(new WflowUpdateDocumentStateConnector(), app);
84
+ container.setNode(new WflowSubscribeWebhookBatch(), app);
85
+ container.setNode(new WflowUnsubscribeWebhookBatch(), app);
86
+ // ... register remaining connectors similarly
87
+ ```
88
+
89
+ ## License
90
+
91
+ This connector is released under the **Apache License 2.0**. See the [LICENSE](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE) file for the full license text.
92
+
93
+ ## Contributing
94
+
95
+ Contributions are welcome! This connector is part of the open-source [Orchesty Node.js Connectors](https://github.com/Orchesty/orchesty-nodejs-connectors) monorepo.
96
+
97
+ For guidelines on how to create or update connectors — including project setup, coding conventions, and how to write tests — please refer to the **[Contributing to Connectors](https://orchesty.io/community/contributing-to-connectors)** guide.
98
+
99
+ All contributions should include:
100
+ - Source code in `src/` following the existing connector structure
101
+ - Tests in `src/**/__tests__/` with `input.json`, `mock.json`, and `output.json` fixtures
102
+ - An updated `CHANGELOG.md` entry
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@orchesty/connector-wflow",
3
3
  "description": "",
4
- "version": "1.0.5",
4
+ "version": "2.0.1",
5
5
  "license": "Apache-2.0",
6
6
  "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
- "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Orchesty/orchesty-nodejs-connectors"
10
+ },
8
11
  "keywords": [],
9
12
  "author": "info@hanaboso.com",
10
13
  "dependencies": {
11
- "@orchesty/nodejs-sdk": "^4.3.6"
14
+ "@orchesty/nodejs-sdk": "^5.0.13",
15
+ "http-status-codes": "^2.3.0"
12
16
  },
13
17
  "engines": {
14
18
  "node": ">=24"
@@ -25,6 +25,7 @@ export default class WflowSubscribeWebhookBatch extends ABatchNode {
25
25
  const registeredEvents = (await repository.findMany({
26
26
  users: [appInstall.getUser()],
27
27
  apps: [appInstall.getName()],
28
+ sdks: [appInstall.getSdk()],
28
29
  })).map((webhook) => webhook.getName());
29
30
 
30
31
  const unsubscribed = subscriptions.find(
@@ -69,6 +70,7 @@ export default class WflowSubscribeWebhookBatch extends ABatchNode {
69
70
  new Webhook()
70
71
  .setWebhookId(id)
71
72
  .setUser(appInstall.getUser())
73
+ .setSdk(appInstall.getSdk())
72
74
  .setNode(unsubscribed.getNode())
73
75
  .setToken(token)
74
76
  .setApplication(appInstall.getName())
@@ -4,6 +4,7 @@ import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
4
4
  import OnRepeatException from '@orchesty/nodejs-sdk/dist/lib/Exception/OnRepeatException';
5
5
  import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
6
6
  import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
7
+ import { StatusCodes } from 'http-status-codes';
7
8
  import WflowApplication, { NAME as WFLOW_APP_NAME } from '../WflowApplication';
8
9
 
9
10
  export const NAME = `${WFLOW_APP_NAME}-unsubscribe-webhooks-batch`;
@@ -22,6 +23,7 @@ export default class WflowUnsubscribeWebhookBatch extends ABatchNode {
22
23
  const webhook = await repository.findOne({
23
24
  users: [appInstall.getUser()],
24
25
  apps: [appInstall.getName()],
26
+ sdks: [appInstall.getSdk()],
25
27
  });
26
28
 
27
29
  if (!webhook) {
@@ -45,7 +47,7 @@ export default class WflowUnsubscribeWebhookBatch extends ABatchNode {
45
47
 
46
48
  const response = await this.getSender().send(request);
47
49
 
48
- if (response.getResponseCode() as number !== 200) {
50
+ if (response.getResponseCode() !== StatusCodes.OK) {
49
51
  await repository.update(webhook.setUnsubscribeFailed(true));
50
52
  throw new OnRepeatException(300, 12, response.getBody());
51
53
  }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "headers": {
3
- "user": "TestUser"
3
+ "user": "TestUser",
4
+ "sdk": "TestSdk"
4
5
  },
5
6
  "data": {}
6
7
  }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "headers": {
3
- "user": "TestUser"
3
+ "user": "TestUser",
4
+ "sdk": "TestSdk"
4
5
  },
5
6
  "data": []
6
- }
7
+ }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "headers": {
3
- "user": "TestUser"
3
+ "user": "TestUser",
4
+ "sdk": "TestSdk"
4
5
  },
5
6
  "data": {}
6
- }
7
+ }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "headers": {
3
- "user": "TestUser"
3
+ "user": "TestUser",
4
+ "sdk": "TestSdk"
4
5
  },
5
6
  "data": []
6
- }
7
+ }
@@ -1,9 +1,10 @@
1
1
  {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- "organization": "test",
7
- "documentId": "463b5265-2672-4191-9e3b-9d6fcfe6a452"
8
- }
2
+ "headers": {
3
+ "user": "TestUser",
4
+ "sdk": "TestSdk"
5
+ },
6
+ "data": {
7
+ "organization": "test",
8
+ "documentId": "463b5265-2672-4191-9e3b-9d6fcfe6a452"
9
+ }
9
10
  }